layui.use(['form', 'layer','formSelects','table'], function () {
    var form = layui.form,
        layer = layui.layer === undefined ? layui.layer : top.layer,
        formSelects = layui.formSelects,
        $ = layui.jquery,
        table = layui.table;



    /*添加*/
    //监听提交
    form.on("submit(sub)", function(data){
        var url=ctx+"/user/register";
        /*发送ajax操作*/
        $.post(url,data.field,function (result){
            //判断
            if(result.code==200){
                layer.msg("注册成功");
                //刷新
                window.location.reload();
            }else{
                //提示一下
                layer.msg(result.msg,{icon:5 });
            }
        },"json");
    });

});



